import { BasicColumn, FormSchema } from '@/components/Table';
import { JVxeTypes } from '@/components/jeecg/JVxeTable/src/types';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'SKU名称',
    align: 'center',
    dataIndex: 'skuName',
  },
  {
    title: '商品名称',
    align: 'center',
    dataIndex: 'prodName',
  },
  {
    title: '供应商标识',
    align: 'center',
    dataIndex: 'supplierId',
  },
  {
    title: '商品属性',
    align: 'center',
    dataIndex: 'properties',
  },
  {
    title: '商品标识',
    align: 'center',
    dataIndex: 'prodId',
  },
  {
    title: 'SKU图片',
    align: 'center',
    dataIndex: 'pic',
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status',
  },
  {
    title: '原价',
    align: 'center',
    dataIndex: 'oriPrice',
  },
  {
    title: '现价',
    align: 'center',
    dataIndex: 'price',
  },
  {
    title: '实际库存',
    align: 'center',
    dataIndex: 'actualStock',
  },
  {
    title: '扣除库存',
    align: 'center',
    dataIndex: 'stocks',
  },
  {
    title: '重量',
    align: 'center',
    dataIndex: 'weight',
  },
  {
    title: '体积',
    align: 'center',
    dataIndex: 'volume',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'SKU名称',
    field: 'skuName',
    component: 'Input',
  },
  {
    label: '商品名称',
    field: 'prodName',
    component: 'Input',
  },
  {
    label: '供应商标识',
    field: 'supplierId',
    component: 'Input',
  },
  {
    label: '商品属性',
    field: 'properties',
    component: 'Input',
  },
  {
    label: '商品标识',
    field: 'prodId',
    component: 'Input',
  },
  {
    label: 'SKU图片',
    field: 'pic',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'InputNumber',
  },
  {
    label: '原价',
    field: 'oriPrice',
    component: 'InputNumber',
  },
  {
    label: '现价',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '实际库存',
    field: 'actualStock',
    component: 'InputNumber',
  },
  {
    label: '扣除库存',
    field: 'stocks',
    component: 'InputNumber',
  },
  {
    label: '重量',
    field: 'weight',
    component: 'InputNumber',
  },
  {
    label: '体积',
    field: 'volume',
    component: 'InputNumber',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  skuName: { title: 'SKU名称', order: 0, view: 'text', type: 'string' },
  prodName: { title: '商品名称', order: 1, view: 'text', type: 'string' },
  supplierId: { title: '供应商标识', order: 2, view: 'text', type: 'string' },
  properties: { title: '商品属性', order: 3, view: 'text', type: 'string' },
  prodId: { title: '商品标识', order: 4, view: 'text', type: 'string' },
  pic: { title: 'SKU图片', order: 5, view: 'text', type: 'string' },
  status: { title: '状态', order: 6, view: 'number', type: 'number' },
  oriPrice: { title: '原价', order: 7, view: 'number', type: 'number' },
  price: { title: '现价', order: 8, view: 'number', type: 'number' },
  actualStock: { title: '实际库存', order: 10, view: 'number', type: 'number' },
  stocks: { title: '扣除库存', order: 11, view: 'number', type: 'number' },
  weight: { title: '重量', order: 12, view: 'number', type: 'number' },
  volume: { title: '体积', order: 13, view: 'number', type: 'number' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}

export const editTableColumns = [
  {
    title: 'SKU名称',
    key: 'skuName',
    width: 400,
    type: JVxeTypes.input,
    defaultValue: '',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '属性',
    key: 'properties',
    width: 180,
    type: JVxeTypes.selectMultiple,
    defaultValue: '',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
    dictCode: 'uf_mall_prod_prop_value,group_name_value,id,del_flag=0',
  },
  {
    title: '图片',
    key: 'pic',
    width: 180,
    type: JVxeTypes.upload,
    defaultValue: '',
    placeholder: '请上传SKU${title}',
    validateRules: [{ required: true, message: '${title}SKU不能为空' }],
  },
  {
    title: '原价',
    key: 'oriPrice',
    width: 180,
    type: JVxeTypes.inputNumber,
    defaultValue: '0.00',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '现价',
    key: 'price',
    width: 180,
    type: JVxeTypes.inputNumber,
    defaultValue: '0.00',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '重量（kg）',
    key: 'weight',
    width: 180,
    type: JVxeTypes.inputNumber,
    defaultValue: '0.00',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '体积（m³）',
    key: 'volume',
    width: 180,
    type: JVxeTypes.inputNumber,
    defaultValue: '0.00',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '库存',
    key: 'actualStock',
    width: 180,
    type: JVxeTypes.inputNumber,
    defaultValue: '0',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '商品条形码',
    key: 'barCode',
    width: 180,
    type: JVxeTypes.input,
    defaultValue: '0',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
  },
  {
    title: '状态',
    key: 'status',
    width: 180,
    type: JVxeTypes.select,
    defaultValue: '0',
    placeholder: '请输入${title}',
    validateRules: [{ required: true, message: '${title}不能为空' }],
    dictCode: 'goods_status',
  },
];
